home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 May / may_2001.iso / intercd / root / Multimedia / ^DivX_Article / virtualdub / VirtualDub-source-1_4d / Dub.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-20  |  4.4 KB  |  197 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    Copyright (C) 1998-2001 Avery Lee
  3. //
  4. //    This program is free software; you can redistribute it and/or modify
  5. //    it under the terms of the GNU General Public License as published by
  6. //    the Free Software Foundation; either version 2 of the License, or
  7. //    (at your option) any later version.
  8. //
  9. //    This program is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. //    GNU General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU General Public License
  15. //    along with this program; if not, write to the Free Software
  16. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #ifndef f_DUB_H
  19. #define f_DUB_H
  20.  
  21. #include <windows.h>
  22. #include <mmsystem.h>
  23. #include <vfw.h>
  24.  
  25. #include "Error.h"
  26. #include "audio.h"
  27. #include "filters.h"
  28.  
  29. class Histogram;
  30. class AsyncBlitter;
  31. class AVIPipe;
  32. class AVIOutput;
  33. class DubSource;
  34. class AudioSource;
  35. class VideoSource;
  36. class FrameSubset;
  37. class InputFile;
  38. class IDubStatusHandler;
  39.  
  40. ////////////////////////
  41.  
  42. class DubAudioOptions {
  43. public:
  44.     enum {
  45.         P_NOCHANGE=0,
  46.         P_8BIT=1,
  47.         P_16BIT=2,
  48.         C_NOCHANGE=0,
  49.         C_MONO=1,
  50.         C_STEREO=2,
  51.         C_MONOLEFT=3,
  52.         C_MONORIGHT=4,
  53.         M_NONE            = 0,
  54.         M_FULL            = 1,
  55.     };
  56.  
  57.     long volume;        // 0, or 8-bit fixed point fraction
  58.  
  59.     long preload;
  60.     long interval;
  61.     long new_rate;
  62.     long offset;
  63.     bool is_ms;
  64.     bool enabled;
  65.     bool fStartAudio, fEndAudio;
  66.     bool integral_rate;
  67.     bool fHighQuality;
  68.     char newPrecision;
  69.     char newChannels;
  70.     char mode;
  71. };
  72.  
  73. class DubVideoOptions {
  74. public:
  75.     enum {
  76.         D_16BIT = 0,
  77.         D_24BIT = 1,
  78.         D_32BIT    = 2,
  79.     };
  80.     enum {
  81.         M_NONE        = 0,
  82.         M_FASTREPACK= 1,
  83.         M_SLOWREPACK= 2,
  84.         M_FULL        = 3,
  85.     };
  86.     enum {
  87.         FR_SAMELENGTH = -1
  88.     };
  89.  
  90.     char    inputDepth, outputDepth;
  91.     char    mode;
  92.     BOOL    fShowInputFrame, fShowOutputFrame, fShowDecompressedFrame;
  93.     BOOL    fHistogram, fSyncToAudio;
  94.     int        frameRateDecimation;
  95.     long    frameRateNewMicroSecs;
  96.  
  97.     long    lStartOffsetMS;
  98.     long    lEndOffsetMS;
  99.  
  100.     bool    fInvTelecine;
  101.     bool    fIVTCMode;
  102.     int        nIVTCOffset;
  103.     bool    fIVTCPolarity;
  104.  
  105.     int        nPreviewFieldMode;
  106. };
  107.  
  108. class DubPerfOptions {
  109. public:
  110.     long    outputBufferSize;
  111.     long    waveBufferSize;
  112.     long    pipeBufferCount;
  113.  
  114.     bool    dynamicEnable;
  115.     bool    dynamicShowDisassembly;
  116.     bool    useDirectDraw;
  117.     bool    fDropFrames;
  118. };
  119.  
  120. class DubOptions {
  121. public:
  122.     DubAudioOptions audio;
  123.     DubVideoOptions video;
  124.     DubPerfOptions perf;
  125.  
  126.     bool    fShowStatus, fMoveSlider;
  127. };
  128.  
  129. class DubStreamInfo {
  130. public:
  131.     long    start_src;
  132.     long    cur_src;
  133.     long    cur_proc_src;
  134.     long    end_src;
  135.     long    start_dst;
  136.     long    cur_dst;
  137.     long    end_dst;
  138.     __int64    total_size;
  139. };
  140.  
  141. class DubAudioStreamInfo : public DubStreamInfo {
  142. public:
  143.     AudioFormatConverter formatConverter;
  144.     long    samp_frac;
  145.     bool    converting, resampling;
  146.     bool    is_16bit;
  147.     bool    is_stereo;
  148.     bool    is_right;
  149.     bool    single_channel;
  150.     char    bytesPerSample;
  151.  
  152.     long    lPreloadSamples;
  153. };
  154.  
  155. class DubVideoStreamInfo : public DubStreamInfo {
  156. public:
  157.     long    usPerFrame;
  158.     long    usPerFrameIn;
  159.     long    usPerFrameNoTelecine;
  160.     long    processed;
  161.     bool    fAudioOnly;
  162. };
  163.  
  164. class IDubber {
  165. public:
  166.     virtual ~IDubber()                    =0;
  167.  
  168.     virtual void SetAudioCompression(WAVEFORMATEX *wf, LONG cb)    =0;
  169.     virtual void SetInputFile(InputFile *)=0;
  170.     virtual void SetPhantomVideoMode()=0;
  171.     virtual void SetFrameRectangles(RECT *prInput, RECT *prOutput)=0;
  172.     virtual void EnableSpill(const char *pszPrefix, __int64 size, long lFrameLimit)=0;
  173. //    virtual void InitStreamValues(VideoSource *video, AudioSource *audio, AVIOutput *out)    =0;
  174.     virtual void Init(VideoSource *video, AudioSource *audio, AVIOutput *out, char *szFile, HDC hDC, COMPVARS *videoCompVars)    =0;
  175.     virtual void Go(int iPriority = 0)    =0;
  176.  
  177.     virtual void RealizePalette()    =0;
  178.     virtual void Abort()            =0;
  179.     virtual bool isAbortedByUser()    =0;
  180.     virtual void Tag(int x, int y)    =0;
  181.     virtual void SetClientRectOffset(int x, int y) = 0;
  182.  
  183.     virtual void SetStatusHandler(IDubStatusHandler *pdsh)        =0;
  184.     virtual void SetPriority(int index)=0;
  185.     virtual void UpdateFrames()=0;
  186. };
  187.  
  188. IDubber *CreateDubber(DubOptions *xopt);
  189. void InitStreamValuesStatic(DubVideoStreamInfo& vInfo, DubAudioStreamInfo& aInfo, VideoSource *video, AudioSource *audio, DubOptions *opt, FrameSubset *pfs=NULL);
  190.  
  191. #ifndef f_DUB_CPP
  192.  
  193. extern DubOptions g_dubOpts;
  194. #endif
  195.  
  196. #endif
  197.